unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls;

type
  TForm2 = class(TForm)
    DateTimePicker1: TDateTimePicker;
    DataL: TLabel;
    Inicio: TEdit;
    Fin: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    Total: TLabel;
    LabelDataFinal: TLabel;
    DateTimePickerFinal: TDateTimePicker;
    Label3: TLabel;
    Label4: TLabel;
    Edit_HoraD: TEdit;
    Label5: TLabel;
    procedure FormShow(Sender: TObject);
    procedure DateTimePicker1Change(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
  var
  i,f,hd : TTime;

begin
    i:= StrToTime(Inicio.Text);
    f:= StrToTime(Fin.Text);
    hd:= StrToTime(Edit_HoraD.Text);

    LabelDataFinal.Caption:= DateToStr(DateTimePickerFinal.Date);

   Total.Caption:= TimeToStr((f-i)-hd);
end;

procedure TForm2.DateTimePicker1Change(Sender: TObject);
begin
DataL.Caption:= DateToStr(DateTimePicker1.Date);
end;

procedure TForm2.FormShow(Sender: TObject);
begin
  DateTimePicker1.Date:= now;
  DataL.Caption:= DateToStr(DateTimePicker1.Date);
end;

end.
